package org.cshoo.sys.model
{
	
	import com.adobe.cairngorm.model.IModelLocator;
	
	import mx.collections.ArrayCollection;
	
	import org.cshoo.sys.model.vo.Dictionary;
	import org.cshoo.sys.model.vo.Menu;
	import org.cshoo.sys.model.vo.Organization;
	import org.cshoo.sys.model.vo.Parameter;
	import org.cshoo.sys.model.vo.Role;
	import org.cshoo.sys.model.vo.User;
		
	
	[Bindable]
	public class SysModelLocator implements IModelLocator 
	{
	
		private static var instance:SysModelLocator;

		// DECLARE PROPERTIES HERE
		public var dictionaryCollection:Array;//字典数据集合
		public var dictionaryCollectionTotalRecord:Number;//字典数据总记录数，这里指的是数据库中总的记录数
		
		public var currentDictionary:Dictionary;
		public var menuCollection:Array;
		public var currentMenu:Menu;
		public var organizationCollection:Array;
		public var currentOrganization:Organization;
		public var parameterCollection:Array;
		public var currentParameter:Parameter;
		public var roleCollection:Array;          
		public var currentRole:Role;
		public var userCollection:Array;
		
		/**
		 * 当前登录的用户
		 **/
		public var currentUser:User;
		
		/**
		 * 为根节点的全部菜单的集合
		 **/
		public var rootMenuCollection:Array;
		
		/**
		 * 为根节点的全部组织机构的集合
		 **/
		public var rootOrganizationCollection:Array;
		
		/**
		 * 角色菜单权限集合
		 **/
		public var roleAuthorityCollection:Array;
		
		/**
		 * 用户菜单权限集合
		 **/
		public var userAuthorityCollection:Array;
		
		/**
		 * 当前登录用户的根菜单集合
		 **/
		public var currentUserRootMenuCollection:Array;
		
		
		public static function getInstance():SysModelLocator
		{
			if(instance==null)	instance = new SysModelLocator();
			return instance;
		}

		public function SysModelLocator()
		{
			if(instance!=null) throw new Error("Error: Singletons can only be instantiated via getInstance() method!");
			SysModelLocator.instance = this;
		}
	}
}